package me.zhujin.java.learnjava.myserver.servlet;

import me.zhujin.java.learnjava.myserver.MyRequest;
import me.zhujin.java.learnjava.myserver.MyResponse;
import me.zhujin.java.learnjava.myserver.MyServlet;
import me.zhujin.java.learnjava.myserver.util.ScriptUtil;

import java.io.FileNotFoundException;

/**
 * Created by zhujin on 10/24/16.
 * blog:www.zhujin.me
 * email: zhujin.nova@gmail.com
 */
public class LoginMyServlet extends MyServlet {

    @Override
    protected void doPost(MyRequest request, MyResponse response) throws Exception {
        doGet(request, response);
    }

    @Override
    protected void doGet(MyRequest request, MyResponse response) throws Exception {
        String name = request.getParmer("name");
        String password = request.getParmer("password");
        if (name == null) {
            flushBody(response, "-名字为空-");
            return;
        }
        if (password == null) {
            flushBody(response, "-密码为空-");
            return;
        }
        if (name.equals("zhujin.me") && password.equals("leaderus")) {
            flushBody(response, "欢迎-" + name + " Login-zhujin-Servlet");
        } else {
            flushBody(response, "用户名.密码错误");
        }


    }


}
